# ============================================================================
# Table 3: Overall support for policies by condition
# ============================================================================

police_pct <- mean(data$race_view_police == 1, na.rm = TRUE) * 100
poverty_pct <- mean(data$race_view_poverty == 1, na.rm = TRUE) * 100

police_str <- paste0(fmt(x = police_pct, digits = 2), "\\%")
poverty_str <- paste0(fmt(x = poverty_pct, digits = 2), "\\%")

table_3 <- sprintf(fmt = "\\caption{Percent of respondents who view policing and income policies as Black-centered issues}
\\centering
\\begin{tabular}{ll}
\\hline
Policing policy & %s \\\\
Income policy   & %s \\\\ \\hline
\\end{tabular}",
                   police_str,
                   poverty_str)

writeLines(text = table_3, con = "code_and_output/tables/table_3.tex")

rm(list = setdiff(ls(), c("data", "fmt", "format_int", "n_sims")))
gc()